home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / asm32v20.zip / CW.INC < prev    next >
Text File  |  1994-01-01  |  25KB  |  1,017 lines

  1. ;-------------------------------------------------------------------------------
  2. Sys    macro p1
  3. ;
  4. ;Call a CauseWay system function. Operand supplied is the function number. Use
  5. ;of this macro is not obligatory, use your own version if you want.
  6. ;
  7.     mov    ax,p1
  8.     int    31h
  9.     endm
  10.  
  11.  
  12. ;-------------------------------------------------------------------------------
  13. ;
  14. ;Get system selectors/flags.
  15. ;
  16. ;On Exit:-
  17. ;
  18. ;AX    - Selector for real mode segment address of 00000h, 4G limit.
  19. ;BX    - Selector for current PSP segment. 100h limit.
  20. ;[E]CX    - Dos transfer buffer size. Always <64k.
  21. ;DX    - Dos transfer buffer real mode segment address.
  22. ;ES:[E]SI    - Dos transfer buffer protected mode address. ESI+ECX ALWAYS <64k.
  23. ;EDI    - System flags. Bits significant if set.
  24. ;
  25. ;    0 - 32 bit code default.
  26. ;
  27. ;    1 - Virtual memory manager functional.
  28. ;
  29. ;    2 \ Mode, 0 - raw, 1 - VCPI, 2 - DPMI.
  30. ;    3 /
  31. ;
  32. ;    4 - DPMI available.
  33. ;    5 - VCPI available.
  34. ;    6 - No memory managers.
  35. ;
  36. ;    7 - Descriptor table type. 0 - GDT, 1 - LDT.
  37. ;
  38. ;NOTES:-
  39. ;
  40. ;Bits 1-2 of DI indicate the interface type being used by CauseWay. Bits 4-5
  41. ;indicate the interface types that are available.
  42. ;
  43. ;Bit 7 indicates the descriptor table being used to allocate selectors to the
  44. ;application when on a raw/vcpi system.
  45. ;
  46. ;The Dos transfer buffer is the area CauseWay uses to transfer data between
  47. ;conventional and extended memory during DOS interrupts. This memory can be used
  48. ;as temporary work space for your own access to real mode code as long as you
  49. ;remember it may be over written the next time you issue an INT in protected
  50. ;mode that requires segment&|offset pointers.
  51. ;
  52. Info    equ    0ff00h        ;Get general purpose segment selectors.
  53.  
  54.  
  55. ;-------------------------------------------------------------------------------
  56. ;
  57. ;Simulate real mode interrupt.
  58. ;
  59. ;On Entry:-
  60. ;
  61. ;BL    - Interrupt number.
  62. ;ES:[E]DI    - Parameter block.
  63. ;
  64. ;On Exit:-
  65. ;
  66. ;Parameter block updated.
  67. ;
  68. ;NOTES:-
  69. ;
  70. ;The parameter block referanced by ES:[E]DI should contain the register values
  71. ;you want passing to the real mode interrupt handler. The SS:SP & Flags entries
  72. ;are currently filled in by CauseWay to ensure legal values are used and the
  73. ;CS:IP entries are ignored. This function bypasses protected mode interrupt
  74. ;handlers and provides access to INT API's that would not otherwise be available
  75. ;using CauseWay.
  76. ;
  77. IntXX    equ    0ff01h
  78.  
  79.  
  80. ;-------------------------------------------------------------------------------
  81. ;
  82. ;Simulate real mode far call.
  83. ;
  84. ;On Entry:-
  85. ;
  86. ;ES:[E]DI    - Parameter block.
  87. ;
  88. ;On Exit:-
  89. ;
  90. ;Parameter block updated.
  91. ;
  92. ;NOTES:-
  93. ;
  94. ;This function works much the same as IntXX but provides a 16 bit FAR stack
  95. ;frame and the CS:IP values used to pass control to the real mode code.
  96. ;
  97. FarCallReal    equ    0ff02h
  98.  
  99.  
  100. ;-------------------------------------------------------------------------------
  101. ;
  102. ;Allocate real mode call back address.
  103. ;
  104. ;On Entry:-
  105. ;
  106. ;DS:[E]SI    - Call address.
  107. ;ES:[E]DI    - Real mode register structure.
  108. ;
  109. ;On Exit:-
  110. ;
  111. ;Carry set on error, else,
  112. ;
  113. ;CX:DX    - Real mode address to trigger mode switch.
  114. ;
  115. ;NOTES:-
  116. ;
  117. ;Real mode CallBack's provide a means of switching from real mode to protected
  118. ;mode. The address returned by this function is a unique real mode address that
  119. ;when given control in real mode will switch to protected mode and pass control
  120. ;to the protected mode routine supplied at entry to this function.
  121. ;
  122. GetCallBack    equ    0303h
  123.  
  124.  
  125. ;-------------------------------------------------------------------------------
  126. ;
  127. ;Release a real mode call back entry.
  128. ;
  129. ;On Entry:-
  130. ;
  131. ;CX:DX    - Real mode address returned by GetCallBack
  132. ;
  133. RelCallBack    equ    0304h
  134.  
  135.  
  136. ;-------------------------------------------------------------------------------
  137. ;
  138. ;Get Protected mode interrupt handler address.
  139. ;
  140. ;On Entry:-
  141. ;
  142. ;BL    - Interrupt vector number.
  143. ;
  144. ;On Exit:-
  145. ;
  146. ;CF set on error else:-
  147. ;
  148. ;CX:[E]DX    - selector:offset of handler.
  149. ;
  150. GetVect    equ    0204h
  151.  
  152.  
  153. ;-------------------------------------------------------------------------------
  154. ;
  155. ;Set Protected mode interrupt handler address.
  156. ;
  157. ;On Entry:-
  158. ;
  159. ;BL    - Interrupt vector number.
  160. ;CX:[E]DX    - selector:offset of new handler.
  161. ;
  162. ;On Exit:-
  163. ;
  164. ;CF set on error.
  165. ;
  166. SetVect    equ    0205h
  167.  
  168.  
  169. ;-------------------------------------------------------------------------------
  170. ;
  171. ;Get real mode interrupt handler address.
  172. ;
  173. ;On Entry:-
  174. ;
  175. ;BL    - Interrupt vector number.
  176. ;
  177. ;On Exit:-
  178. ;
  179. ;CF set on error else:-
  180. ;
  181. ;CX:DX    - selector:offset of handler.
  182. ;
  183. GetRVect    equ    0200h
  184.  
  185.  
  186. ;-------------------------------------------------------------------------------
  187. ;
  188. ;Set real mode interrupt handler address.
  189. ;
  190. ;On Entry:-
  191. ;
  192. ;BL    - Interrupt vector number.
  193. ;CX:DX    - selector:offset of new handler.
  194. ;
  195. ;On Exit:-
  196. ;
  197. ;CF set on error.
  198. ;
  199. SetRVect    equ    0201h
  200.  
  201.  
  202. ;-------------------------------------------------------------------------------
  203. ;
  204. ;Get Protected mode exception handler address.
  205. ;
  206. ;On Entry:-
  207. ;
  208. ;BL    - Exception vector number.
  209. ;
  210. ;On Exit:-
  211. ;
  212. ;CF set on error else:-
  213. ;
  214. ;CX:[E]DX    - selector:offset of handler.
  215. ;
  216. GetEVect    equ    0202h
  217.  
  218.  
  219. ;-------------------------------------------------------------------------------
  220. ;
  221. ;Set Protected mode exception handler address.
  222. ;
  223. ;On Entry:-
  224. ;
  225. ;BL    - Exception vector number.
  226. ;CX:[E]DX    - selector:offset of new handler.
  227. ;
  228. ;On Exit:-
  229. ;
  230. ;CF set on error.
  231. ;
  232. SetEVect    equ    0203h
  233.  
  234.  
  235. ;-------------------------------------------------------------------------------
  236. ;
  237. ;Allocate a new selector.
  238. ;
  239. ;On Exit:-
  240. ;
  241. ;BX    - Selector.
  242. ;
  243. ;NOTES:-
  244. ;
  245. ;A selector is allocated and initialized with a base of 0, a limit of 0 and as
  246. ;read/write expand up data. Use SetSelDet to make the selector useful.
  247. ;
  248. GetSel    equ    0ff03h
  249.  
  250.  
  251. ;-------------------------------------------------------------------------------
  252. ;
  253. ;Release a selector.
  254. ;
  255. ;On Entry:-
  256. ;
  257. ;BX    - Selector.
  258. ;
  259. RelSel    equ    0ff04h
  260.  
  261.  
  262. ;-------------------------------------------------------------------------------
  263. ;
  264. ;Make a selector execute/read type.
  265. ;
  266. ;On Entry:-
  267. ;
  268. ;BX    - Selector.
  269. ;CL    - Default operation size. (0=16 bit,1=32 bit)
  270. ;
  271. ;NOTES:-
  272. ;
  273. ;Allows a selector to be converted to a type suitable for execution.
  274. ;
  275. CodeSel    equ    0ff05h
  276.  
  277.  
  278. ;-------------------------------------------------------------------------------
  279. ;
  280. ;Create a read/write data selector with same base and limit as selector
  281. ;supplied.
  282. ;
  283. ;On Entry:-
  284. ;
  285. ;BX    - Source selector
  286. ;
  287. ;On Exit:-
  288. ;
  289. ;If function was successful:
  290. ;Carry flag is clear.
  291. ;AX    - New data selector
  292. ;
  293. ;If function was not successful:
  294. ;Carry flag is set.
  295. ;
  296. ;NOTES:-
  297. ;
  298. ;This function always creates a read/write data selector regardless of the
  299. ;source selectors type. Can be used to provide access to variables in a code
  300. ;segment etc.
  301. ;
  302. AliasSel    equ    0ff06h
  303.  
  304.  
  305. ;-------------------------------------------------------------------------------
  306. ;
  307. ;Get selector linear base and limit.
  308. ;
  309. ;On Entry:-
  310. ;
  311. ;BX    - Selector
  312. ;
  313. ;On Exit:-
  314. ;
  315. ;CX:DX    - Linear base.
  316. ;SI:DI    - Byte granular limit.
  317. ;
  318. GetSelDet    equ    0ff07h
  319.  
  320.  
  321. ;-------------------------------------------------------------------------------
  322. ;
  323. ;Get selector linear base and limit.
  324. ;
  325. ;On Entry:-
  326. ;
  327. ;BX    - Selector
  328. ;
  329. ;On Exit:-
  330. ;
  331. ;EDX    - Linear base.
  332. ;ECX    - Byte granular limit.
  333. ;
  334. GetSelDet32    equ    0ff08h
  335.  
  336.  
  337. ;-------------------------------------------------------------------------------
  338. ;
  339. ;Set selector linear base and limit.
  340. ;
  341. ;On Entry:-
  342. ;
  343. ;BX    - Selector.
  344. ;CX:DX    - Linear base.
  345. ;SI:DI    - Byte granular limit.
  346. ;
  347. SetSelDet    equ    0ff09h
  348.  
  349.  
  350. ;-------------------------------------------------------------------------------
  351. ;
  352. ;Set selector linear base and limit.
  353. ;
  354. ;On Entry:-
  355. ;
  356. ;BX    - Selector.
  357. ;EDX    - Linear base.
  358. ;ECX    - Byte granular limit.
  359. ;
  360. SetSelDet32    equ    0ff0ah
  361.  
  362.  
  363. ;-------------------------------------------------------------------------------
  364. ;
  365. ;Allocate a block of memory.
  366. ;
  367. ;On Entry:-
  368. ;
  369. ;CX:DX    - Size of block required in bytes. (-1:-1 to get maximum memory size)
  370. ;
  371. ;On Exit:-
  372. ;
  373. ;Carry clear if OK &
  374. ;
  375. ;BX    - Selector to access the block with.
  376. ;
  377. ;Else if CX:DX was -1, CX:DX is size of largest block available.
  378. ;
  379. ;NOTES:-
  380. ;
  381. ;This function allocates a block of extended (application) memory, and also a
  382. ;selector with a suitable base & limit.
  383. ;
  384. GetMem    equ    0ff0bh
  385.  
  386.  
  387. ;-------------------------------------------------------------------------------
  388. ;
  389. ;Allocate a block of memory.
  390. ;
  391. ;On Entry:-
  392. ;
  393. ;ECX    - Size of block required in bytes. (-1 to get maximum memory size)
  394. ;
  395. ;On Exit:-
  396. ;
  397. ;Carry clear if OK &
  398. ;
  399. ;BX    - Selector to access the block with.
  400. ;
  401. ;Else if ECX was -1, ECX is size of largest block available.
  402. ;
  403. ;NOTES:-
  404. ;
  405. ;This function allocates a block of extended (application) memory, and also a
  406. ;selector with a suitable base & limit.
  407. ;
  408. GetMem32    equ    0ff0ch
  409.  
  410.  
  411. ;-------------------------------------------------------------------------------
  412. ;
  413. ;Resize a previously allocated block of memory.
  414. ;
  415. ;On Entry:-
  416. ;
  417. ;BX    - Selector for block.
  418. ;CX:DX    - New size of block required in bytes.
  419. ;
  420. ;On Exit:-
  421. ;
  422. ;Carry clear if OK.
  423. ;
  424. ;NOTES:-
  425. ;
  426. ;If the memory block can't be resized in its current location, but a free block
  427. ;of memory of the new size exists, the memory will be copied to a new block and
  428. ;the old one released. This is transparent to the application as long as only
  429. ;the selector originally allocated with GetMem is being used to access the
  430. ;memory.
  431. ;
  432. ResMem    equ    0ff0dh
  433.  
  434.  
  435. ;-------------------------------------------------------------------------------
  436. ;
  437. ;Resize a previously allocated block of memory.
  438. ;
  439. ;On Entry:-
  440. ;
  441. ;BX    - Selector for block.
  442. ;ECX    - New size of block required in bytes.
  443. ;
  444. ;On Exit:-
  445. ;
  446. ;Carry clear if OK.
  447. ;
  448. ;NOTES:-
  449. ;
  450. ;If the memory block can't be resized in its current location, but a free block
  451. ;of memory of the new size exists, the memory will be copied to a new block and
  452. ;the old one released. This is transparent to the application as long as only
  453. ;the selector originally allocated with GetMem is being used to access the
  454. ;memory.
  455. ;
  456. ResMem32    equ    0ff0eh
  457.  
  458.  
  459. ;-------------------------------------------------------------------------------
  460. ;
  461. ;Release previously allocated block of memory. Is be used for memory allocated
  462. ;by either GetMem or GetMem32.
  463. ;
  464. ;
  465. ;On Entry:-
  466. ;
  467. ;BX    - Selector for block to release.
  468. ;
  469. RelMem    equ    0ff0fh
  470.  
  471.  
  472. ;-------------------------------------------------------------------------------
  473. ;
  474. ;Allocate a block of memory without a selector.
  475. ;
  476. ;On Entry:-
  477. ;
  478. ;CX:DX    - Size of block required in bytes.
  479. ;
  480. ;On Exit:-
  481. ;
  482. ;Carry clear if OK &,
  483. ;
  484. ;SI:DI    - Linear address of block allocated.
  485. ;
  486. ;NOTES:-
  487. ;
  488. ;Addresses returned by this function may be >16M
  489. ;
  490. GetMemLinear    equ    0ff10h
  491.  
  492.  
  493. ;-------------------------------------------------------------------------------
  494. ;
  495. ;Allocate a block of memory without a selector.
  496. ;
  497. ;On Entry:-
  498. ;
  499. ;ECX    - Size of block required in bytes.
  500. ;
  501. ;On Exit:-
  502. ;
  503. ;Carry clear if OK &,
  504. ;
  505. ;ESI    - Linear address of block allocated.
  506. ;
  507. ;NOTES:-
  508. ;
  509. ;Addresses returned by this function may be >16M
  510. ;
  511. GetMemLinear32 equ    0ff11h
  512.  
  513.  
  514. ;-------------------------------------------------------------------------------
  515. ;
  516. ;Resize a previously allocated block of memory without a selector.
  517. ;
  518. ;On Entry:-
  519. ;
  520. ;SI:DI    - Linear address of block to resize.
  521. ;CX:DX    - Size of block required in bytes.
  522. ;
  523. ;On Exit:-
  524. ;
  525. ;Carry clear if OK &,
  526. ;
  527. ;SI:DI    - New linear address of block.
  528. ;
  529. ;NOTES:-
  530. ;
  531. ;If the memory block cannot be expanded to the desired size, and a free block
  532. ;of sufficient size exists, the existing memory will be copied to the free
  533. ;block and released, the new block then being alocated in place of the old.
  534. ;
  535. ResMemLinear    equ    0ff12h
  536.  
  537.  
  538. ;-------------------------------------------------------------------------------
  539. ;
  540. ;Resize a previously allocated block of memory without a selector.
  541. ;
  542. ;On Entry:-
  543. ;
  544. ;ESI    - Linear address of block to resize.
  545. ;ECX    - Size of block required in bytes.
  546. ;
  547. ;On Exit:-
  548. ;
  549. ;Carry clear if OK &,
  550. ;
  551. ;ESI    - New linear address of block.
  552. ;
  553. ;NOTES:-
  554. ;
  555. ;If the memory block cannot be expanded to the desired size, and a free block
  556. ;of sufficient size exists, the existing memory will be copied to the free
  557. ;block and released, the new block then being alocated in place of the old.
  558. ;
  559. ResMemLinear32 equ    0ff13h
  560.  
  561.  
  562. ;-------------------------------------------------------------------------------
  563. ;
  564. ;Release previously allocated block of memory (linear address).
  565. ;
  566. ;On Entry:-
  567. ;
  568. ;SI:DI    - Linear address of block to release.
  569. ;
  570. ;On Exit:-
  571. ;
  572. RelMemLinear    equ    0ff14h
  573.  
  574.  
  575. ;-------------------------------------------------------------------------------
  576. ;
  577. ;Release previously allocated block of memory (linear address).
  578. ;
  579. ;On Entry:-
  580. ;
  581. ;ESI    - Linear address of block to release.
  582. ;
  583. ;On Exit:-
  584. ;
  585. RelMemLinear32 equ    0ff15h
  586.  
  587.  
  588. ;-------------------------------------------------------------------------------
  589. ;
  590. ;Allocate an application relative block of memory.
  591. ;
  592. ;On Entry:-
  593. ;
  594. ;EBX    - Size of block required in bytes.
  595. ;
  596. ;On Exit:-
  597. ;
  598. ;Carry clear if OK &,
  599. ;
  600. ;ESI    - Application relative linear address of block allocated.
  601. ;
  602. ;NOTES:-
  603. ;
  604. ;Addresses returned by this function are as an offset from the application.
  605. ;
  606. GetMemNear    equ    0ff16h
  607.  
  608.  
  609. ;-------------------------------------------------------------------------------
  610. ;
  611. ;Resize a previously allocated application relative block of memory.
  612. ;
  613. ;On Entry:-
  614. ;
  615. ;EBX    - Size of block required in bytes.
  616. ;ESI    - application relative linear address of block to resize.
  617. ;
  618. ;On Exit:-
  619. ;
  620. ;Carry clear if OK &,
  621. ;
  622. ;ESI    - New application relative linear address of block.
  623. ;
  624. ;NOTES:-
  625. ;
  626. ;If the memory block cannot be expanded to the desired size, and a free block
  627. ;of sufficient size exists, the existing memory will be copied to the free
  628. ;block and released, the new block then being allocated in place of the old.
  629. ;
  630. ResMemNear    equ    0ff17h
  631.  
  632.  
  633. ;-------------------------------------------------------------------------------
  634. ;
  635. ;Release previously allocated application relative block of memory.
  636. ;
  637. ;On Entry:-
  638. ;
  639. ;ESI    - Application relative linear address of block to release.
  640. ;
  641. ;On Exit:-
  642. ;
  643. RelMemNear    equ    0ff18h
  644.  
  645.  
  646. ;-------------------------------------------------------------------------------
  647. ;
  648. ;Convert linear address to application relative address.
  649. ;
  650. ;On Entry:-
  651. ;
  652. ;ESI    - Linear address to convert.
  653. ;
  654. ;On Exit:-
  655. ;
  656. ;ESI    - Application relative linear address.
  657. ;
  658. Linear2Near    equ    0ff19h
  659.  
  660.  
  661. ;-------------------------------------------------------------------------------
  662. ;
  663. ;Convert application relative address to linear address.
  664. ;
  665. ;On Entry:-
  666. ;
  667. ;ESI    - Application relative linear address.
  668. ;
  669. ;On Exit:-
  670. ;
  671. ;ESI    - Linear address to convert.
  672. ;
  673. Near2Linear    equ    0ff1ah
  674.  
  675.  
  676. ;-------------------------------------------------------------------------------
  677. ;
  678. ;Lock a region of memory.
  679. ;
  680. ;On Entry:-
  681. ;
  682. ;BX:CX    - Starting linear address of memory to lock.
  683. ;SI:DI    - Size of region to lock in bytes.
  684. ;
  685. ;On Exit:-
  686. ;
  687. ;Carry set on error, none of the memory locked, else memory is locked.
  688. ;
  689. ;NOTES:-
  690. ;
  691. ;Memory that is locked cannot be swapped to disk by the VMM. You should note
  692. ;that locking is applied to memory on 4k boundaries, so areas of memory below
  693. ;and above the memory being locked will also be locked if the specified region
  694. ;is not 4k aligned.
  695. ;
  696. LockMem    equ    0ff1bh
  697.  
  698.  
  699. ;-------------------------------------------------------------------------------
  700. ;
  701. ;Lock a region of memory.
  702. ;
  703. ;On Entry:-
  704. ;
  705. ;ESI    - Starting linear address of memory to lock.
  706. ;ECX    - Size of region to lock in bytes.
  707. ;
  708. ;On Exit:-
  709. ;
  710. ;Carry set on error, none of the memory locked, else memory is locked.
  711. ;
  712. ;NOTES:-
  713. ;
  714. ;Memory that is locked cannot be swapped to disk by the VMM. You should note
  715. ;that locking is applied to memory on 4k boundaries, so areas of memory below
  716. ;and above the memory being locked will also be locked if the specified region
  717. ;is not 4k aligned.
  718. ;
  719. LockMem32    equ    0ff1ch
  720.  
  721.  
  722. ;-------------------------------------------------------------------------------
  723. ;
  724. ;Un-lock a region of memory.
  725. ;
  726. ;On Entry:-
  727. ;
  728. ;BX:CX    - Starting linear address of memory to unlock
  729. ;SI:DI    - Size of region to unlock in bytes
  730. ;
  731. ;NOTES:-
  732. ;
  733. ;This will allow the memory to be swapped to disk by the VMM if necessary.
  734. ;Areas below and above the specified memory will also be un-locked if the
  735. ;specified region is not page aligned.
  736. ;
  737. UnLockMem    equ    0ff1dh
  738.  
  739.  
  740. ;-------------------------------------------------------------------------------
  741. ;
  742. ;Un-lock a region of memory.
  743. ;
  744. ;On Entry:-
  745. ;
  746. ;ESI    - Starting linear address of memory to unlock
  747. ;ECX    - Size of region to unlock in bytes
  748. ;
  749. ;NOTES:-
  750. ;
  751. ;This will allow the memory to be swapped to disk by the VMM if necessary.
  752. ;Areas below and above the specified memory will also be un-locked if the
  753. ;specified region is not page aligned.
  754. ;
  755. UnLockMem32    equ    0ff1eh
  756.  
  757.  
  758. ;-------------------------------------------------------------------------------
  759. ;
  760. ;Lock a region of memory using application relative address.
  761. ;
  762. ;On Entry:-
  763. ;
  764. ;ESI    - Starting linear address of memory to lock.
  765. ;EBX    - Size of region to lock in bytes.
  766. ;
  767. ;On Exit:-
  768. ;
  769. ;Carry set on error, none of the memory locked, else memory is locked.
  770. ;
  771. ;NOTES:-
  772. ;
  773. ;Memory that is locked cannot be swapped to disk by the VMM. You should note
  774. ;that locking is applied to memory on 4k boundaries, so areas of memory below
  775. ;and above the memory being locked will also be locked if the specified region
  776. ;is not 4k aligned.
  777. ;
  778. LockMemNear    equ    0ff1fh
  779.  
  780.  
  781. ;-------------------------------------------------------------------------------
  782. ;
  783. ;Un-lock a region of memory using application relative address.
  784. ;
  785. ;On Entry:-
  786. ;
  787. ;ESI    - Starting linear address of memory to unlock
  788. ;EBX    - Size of region to unlock in bytes
  789. ;
  790. ;NOTES:-
  791. ;
  792. ;This will allow the memory to be swapped to disk by the VMM if necessary.
  793. ;Areas below and above the specified memory will also be un-locked if the
  794. ;specified region is not page aligned.
  795. ;
  796. UnLockMemNear equ    0ff20h
  797.  
  798.  
  799. ;-------------------------------------------------------------------------------
  800. ;
  801. ;Allocate a region of DOS (conventional) memory.
  802. ;
  803. ;On Entry:-
  804. ;
  805. ;BX    - Number of paragraphs (16 byte blocks) required.
  806. ;
  807. ;On Exit:-
  808. ;
  809. ;If function was successful:
  810. ;Carry flag is clear.
  811. ;
  812. ;AX    - Initial real mode segment of allocated block
  813. ;DX    - Initial selector for allocated block
  814. ;
  815. ;If function was not successful:
  816. ;Carry flag is set.
  817. ;
  818. ;AX    - DOS error code.
  819. ;BX    - Size of largest available block in paragraphs.
  820. ;
  821. ;NOTES:-
  822. ;
  823. ;If the size of the block requested is greater than 64K bytes (BX > 1000h) then
  824. ;contiguous descriptors will be allocated. If more than one descriptor is
  825. ;allocated under 32-bit applications, the limit of the first descriptor will be
  826. ;set to the size of the entire block. All subsequent descriptors will have a
  827. ;limit of 64K except for the final descriptor which will have a limit of Block
  828. ;size MOD 64K. 16-bit applications will always set the limit of the first
  829. ;descriptor to 64K.
  830. ;
  831. GetMemDOS    equ    0ff21h
  832.  
  833.  
  834. ;-------------------------------------------------------------------------------
  835. ;
  836. ;Resize a block of DOS (conventional) memory previously allocated with
  837. ;GetMemDOS.
  838. ;
  839. ;On Entry:-
  840. ;
  841. ;BX    - New block size in paragraphs
  842. ;DX    - Selector of block to modify
  843. ;
  844. ;On Exit:-
  845. ;
  846. ;If function was successful:
  847. ;Carry flag is clear.
  848. ;
  849. ;If function was not successful:
  850. ;Carry flag is set.
  851. ;
  852. ;AX    - DOS error code:
  853. ;BX    - Maximum block size possible in paragraphs
  854. ;
  855. ;NOTES:-
  856. ;
  857. ;Growing a memory block is often likely to fail since other DOS block
  858. ;allocations will prevent increasing the size of the block. Also, if the size of
  859. ;a block grows past a 64K boundary then the allocation will fail if the next
  860. ;descriptor in the LDT is  not free.
  861. ;
  862. ResMemDOS    equ    0ff22h
  863.  
  864.  
  865. ;-------------------------------------------------------------------------------
  866. ;
  867. ;Release a block of DOS (conventional) memory previously allocated with
  868. ;GetMemDOS.
  869. ;
  870. ;On Entry:-
  871. ;
  872. ;DX    - Selector of block to free.
  873. ;
  874. ;On Exit:-
  875. ;
  876. ;If function was successful:
  877. ;Carry flag is clear.
  878. ;
  879. ;If function was not successful:
  880. ;Carry flag is set.
  881. ;
  882. ;AX    - DOS error code.
  883. ;
  884. ;NOTES:-
  885. ;
  886. ;All descriptors allocated for the memory block are automatically freed and
  887. ;therefore should not be accessed once the block is freed by this function.
  888. ;
  889. RelMemDOS    equ    0ff23h
  890.  
  891. ;-------------------------------------------------------------------------------
  892. ;
  893. ;Get current address and size of the buffer used for DOS memory transfers.
  894. ;
  895. ;On Exit:
  896. ;
  897. ;BX    - Real mode segment of buffer.
  898. ;DX    - Protected mode selector for buffer.
  899. ;ECX    - Buffer size.
  900. ;
  901. ;Notes:
  902. ;
  903. ;This buffer is used by the built in INT ?? API translation services,
  904. ;e.g. INT 21h, AH=40h (write to file). The default buffer is 8k and uses memory
  905. ;that would otherwise be wasted. This default is sufficient for most file I/O
  906. ;but if you are writing a program that reads/writes large amounts of data you
  907. ;should consider allocateing your own larger buffer and pass the address to
  908. ;CauseWay to speed this file I/O.
  909. ;
  910. GetDOSTrans    equ    0ff25h
  911.  
  912. ;-------------------------------------------------------------------------------
  913. ;
  914. ;Set new address and size of the buffer used for DOS memory transfers.
  915. ;
  916. ;On Entry:
  917. ;
  918. ;BX    - Real mode segment of buffer.
  919. ;DX    - Protected mode selector for buffer.
  920. ;ECX    - Buffer size.
  921. ;
  922. ;Notes:
  923. ;
  924. ;This buffer is used by the built in INT ?? API translation services,
  925. ;e.g. INT 21h, AH=40h (write to file). The default buffer is 8k and uses memory
  926. ;that would otherwise be wasted. This default is sufficient for most file I/O
  927. ;but if you are writing a program that reads/writes large amounts of data you
  928. ;should consider allocateing your own larger buffer and pass the address to
  929. ;CauseWay to speed this file I/O.
  930. ;
  931. ;The buffer must be in conventional memory and only the first 64K will be used
  932. ;even if a bigger buffer is specified. CauseWay will automatically restore the
  933. ;previous buffer setting when the application terminates but GetDOSTrans can
  934. ;be used to get the current buffer's settings if you only want the change to
  935. ;be temporary.
  936. ;
  937. ;You can still use the default buffer for your own purposes even after setting a
  938. ;new address.
  939. ;
  940. SetDOSTrans    equ    0ff26h
  941.  
  942.  
  943. ;-------------------------------------------------------------------------------
  944. ;
  945. ;Get current MCB memory allocation block size.
  946. ;
  947. ;On Exit:
  948. ;
  949. ;ECX    - Current threshold.
  950. ;
  951. GetMCBSize    equ    0ff27h
  952.  
  953.  
  954. ;-------------------------------------------------------------------------------
  955. ;
  956. ;Set new MCB memory allocation block size.
  957. ;
  958. ;On Entry:
  959. ;
  960. ;ECX    - New value to set.
  961. ;
  962. ;On Exit:
  963. ;
  964. ;Carry set on error else new value will be used.
  965. ;
  966. ;Notes:
  967. ;
  968. ;The maximum block size that will be allocated from MCB memory is 16 bytes less
  969. ;than the value set by this function. The default value is 16384.
  970. ;
  971. ;65536 is the maximum value this function will accept. Passing a value above
  972. ;this will return with the carry set and the original value still in force.
  973. ;
  974. ;The CauseWay API memory allocation functions allocate memory from two sources.
  975. ;Allocation requests below the value returned by this function are allocated
  976. ;from a memory pool controlled via conventional style MCB's. Requests above this
  977. ;value are allocated via the normal DPMI functions. Because DPMI memory is
  978. ;always allocated in multiples of 4K it can become very inefficient for any
  979. ;program that needs to allocate small blocks of memory. The value set by this
  980. ;function controls the size of memory chunks that will be allocated to and
  981. ;managed by the MCB system.
  982. ;
  983. ;A value of zero can be passed to this function to disable the MCB allocation
  984. ;system.
  985. ;
  986. ;The value passed will be rounded up to the nearest 4k.
  987. ;
  988. SetMCBMax    equ    0ff28h
  989.  
  990.  
  991. ;-------------------------------------------------------------------------------
  992. ;
  993. ;Structure of parameter table for real mode interrupt and procedure calling.
  994. ;
  995. ;NOTE:- For interrupts, CS:IP,SS:SP & Flags are filled in by the extender.
  996. ;       For far calls, SS:SP & Flags are filled in by the extender.
  997. ;
  998. RealRegsStruc struc
  999. Real_EDI    dd ?    ;EDI
  1000. Real_ESI    dd ?    ;ESI
  1001. Real_EBP    dd ?    ;EBP
  1002.         dd ?    ;Reserved.
  1003. Real_EBX    dd ?    ;EBX
  1004. Real_EDX    dd ?    ;EDX
  1005. Real_ECX    dd ?    ;ECX
  1006. Real_EAX    dd ?    ;EAX
  1007. Real_Flags    dw ?    ;FLAGS
  1008. Real_ES    dw ?    ;ES
  1009. Real_DS    dw ?    ;DS
  1010. Real_FS    dw ?    ;FS
  1011. Real_GS    dw ?    ;GS
  1012. Real_IP    dw ?    ;IP
  1013. Real_CS    dw ?    ;CS
  1014. Real_SP    dw ?    ;SP
  1015. Real_SS    dw ?    ;SS
  1016. RealRegsStruc ends
  1017.